<?php
// +---------------------------------------------------------------------+
// | OneBase    | [ WE CAN DO IT JUST THINK ]                            |
// +---------------------------------------------------------------------+
// | Licensed   | http://www.apache.org/licenses/LICENSE-2.0 )           |
// +---------------------------------------------------------------------+
// | Author     | Bigotry <3162875@qq.com>                               |
// +---------------------------------------------------------------------+
// | Repository | https://gitee.com/Bigotry/OneBase                      |
// +---------------------------------------------------------------------+

namespace app\admin\controller;

use app\common\model\UserAccount;
use app\common\model\UserAccountLog;
use think\Db;

/**
 * 数字资产控制器
 */
class Assets extends AdminBase
{



    /**
     * 数字资产列表
     */
    public function getAccountList()
    {


        $this->assign('list', $this->logicAssets->getAccountList($this->param,'a.*','a.balance desc',50));
        $this->assign('param',$this->param);
        $this->assign('wallet', \app\common\model\Wallet::all(['is_currency'=>1,'status'=>1,'is_virtual'=>1]));
        return $this->fetch();
    }


    /**
     * 数字资产转账管理
     */
    public function transfer()
    {

        $this->assign('list', $this->logicAssets->getTransferList($this->param,'a.*,c.username','a.id desc',50));
        $this->assign('wallet', \app\common\model\Wallet::all(['is_currency'=>1,'status'=>1,'is_virtual'=>1]));
        $this->assign('param',$this->param);
        return $this->fetch();
    }

    /**
     * 数字资产转账管理(已审核)
     */
    public function transfer_check()
    {

        $this->assign('list', $this->logicAssets->getCheckTransferList($this->param,'a.*,c.username','a.id desc',50));
        $this->assign('wallet', \app\common\model\Wallet::all(['is_currency'=>1,'status'=>1,'is_virtual'=>1]));
        $this->assign('param',$this->param);
        return $this->fetch();
    }

    /**
     * 提现记录未审核导出
     */
    public function exportTransferList()
    {


        $this->logicAssets->exportTransferList($this->param);
    }

    /**
     * 提现管理(已审核)导出
     */
    public function exportCheckTransferList()
    {

        $this->logicAssets->exportCheckTransferList($this->param);
    }

    /**
     * 充币记录导出
     */
    public function exportRechargeList()
    {


        $this->logicAssets->exportRechargeList($this->param);
    }
    /**
     * 数字资产充值管理
     */
    public function recharge()
    {
        
        $this->assign('list', $this->logicAssets->getRechargeList($this->param,'a.*,c.username','a.id desc',50));
        $this->assign('wallet', \app\common\model\Wallet::all(['is_currency'=>1,'status'=>1,'is_virtual'=>1]));
        $this->assign('param',$this->param);
        return $this->fetch('recharge_log');
    }

    public function recharge_collect(){
        $list = Db::name("recharge_auto")->alias("a")->join("tp_member b","b.id=a.user_id")->join("tp_wallet c","c.id = a.wallet_id")->field("a.*,b.username,c.name as wallet_name")->order("create_time","desc")->paginate(15);
        $this->assign('wallet', \app\common\model\Wallet::all(['is_currency'=>1,'status'=>1,'is_virtual'=>1]));
        $this->assign("list",$list);
        return $this->fetch('recharge_collect');
    }

    /**
     * 审核转账
     */
    public function  setStatus(){
        $this->jump($this->logicAssets->transfer($this->param));

    }

    /**
     * 重新采集
     */
    public function recollect_recharge(){
        $this->jump($this->logicAssets->recollect($this->param));
    }









}
